home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 26 / Cream of the Crop 26.iso / program / wsc4c21.zip / SIOERROR.C < prev    next >
C/C++ Source or Header  |  1997-05-22  |  2KB  |  75 lines

  1. /*** sioerror.c ***/
  2.  
  3. #include <stdio.h>
  4. #include "windows.h"
  5. #include "sioerror.h"
  6. #include "wsc.h"
  7. #include "paint.h"
  8.  
  9. void cdecl SioError(int Code, char *Text)
  10. {static char Temp[80];
  11. #ifdef WIN32
  12.  DWORD dwError;
  13.  char  *Win32ErrMsg;
  14. #endif
  15.  DisplayString(Text);
  16.  switch(Code)
  17.    {case WSC_NO_DATA:
  18.       DisplayLine("No Data");
  19.       break;
  20.     case WSC_RANGE:
  21.       DisplayLine("Parameter out of range");
  22.       break;
  23.     case WSC_ABORTED:
  24.       DisplayLine("Aborted");
  25.       break;
  26.     case WSC_EXPIRED:
  27.       DisplayLine("Shareware execution expired");
  28.       break;
  29.     case IE_BADID:
  30.       DisplayLine(" Invalid COM port\n");
  31.       break;
  32.     case IE_OPEN:
  33.       DisplayLine(" COM port already open\n");
  34.       break;
  35.     case IE_NOPEN:
  36.       DisplayLine(" Cannot open COM port\n");
  37.       break;
  38.     case IE_MEMORY:
  39.       DisplayLine(" Cannot allocate memory\n");
  40.       break;
  41.     case IE_DEFAULT:
  42.       DisplayLine(" Error in default parameters\n");
  43.       break;
  44.     case IE_HARDWARE:
  45.       DisplayLine(" COM port hardware not present\n");
  46.       break;
  47.     case IE_BYTESIZE:
  48.       DisplayLine(" Unsupported byte size\n");
  49.       break;
  50.     case IE_BAUDRATE:
  51.       DisplayLine(" Unsupported baud rate\n");
  52.       break;
  53. #ifdef WIN32
  54.     case WSC_WIN32ERR:
  55.       dwError = (DWORD) SioWinError();
  56.       if(FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM|FORMAT_MESSAGE_ALLOCATE_BUFFER|80 ,
  57.                       NULL, dwError,
  58.                       MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US),
  59.                       (LPTSTR) &Win32ErrMsg, 0, NULL)
  60.               > 0)
  61.          {DisplayLine(Win32ErrMsg);
  62.          }
  63.       else
  64.          {sprintf(Temp," Win32 Error\n");
  65.           DisplayLine(Temp);
  66.          }
  67.       break;
  68. #endif
  69.     default:
  70.       sprintf(Temp," Unknown code %d\n",Code);
  71.       DisplayLine(Temp);
  72.       break;
  73.    }
  74. } /* end SioError */
  75.